#pragma once

#include<iostream>
#include<ctime>
#include<vector>

typedef void (*task_t)();
void printLog()
{
    std::cout<<"我是一个打印日志的任务"<<std::endl;
}
void Downlode()
{
    std::cout<<"我是一个下载的任务"<<std::endl;
}
void uplode()
{
    std::cout<<"我是一个上传的任务"<<std::endl;

}
class taskManage
{
public:
taskManage()
{
    srand(time(nullptr));
}

void Register(task_t t)
{
    _tasks.push_back(t);
}
int code()
{
    return rand()%_tasks.size();
}
void Execute(int code)
{
    if(code>=0&&code<_tasks.size())
    {
        _tasks[code]();
    }
}


~taskManage(){}
private:
    std::vector<task_t> _tasks;
};